home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 217 / DPCS0306DVD.ISO / Toolkit / Internet / FileZilla / Server / FileZilla_Server-0.9.11.exe / source / install / FileZilla Server.nsi next >
Encoding:
NSIS script  |  2005-11-13  |  18.4 KB  |  596 lines

  1. ;FileZilla Server Setup script
  2. ;written by Tim Kosse (Tim.Kosse@gmx.de)
  3. ;Based on
  4. ;NSIS Modern User Interface version 1.6
  5. ;Basic Example Script
  6. ;Written by Joost Verburg
  7.  
  8. ;--------------------------------
  9. ;Include Modern UI
  10.  
  11.   !include "MUI.nsh"
  12.   !define MUI_LICENSEBKCOLOR /grey
  13.  
  14. ;--------------------------------
  15. ;Product Info
  16.  
  17.   !define PRODUCT_NAME "FileZilla Server"
  18.   !define PRODUCT_VERSION "beta 0.9.11"
  19.   !define PRODUCT_UNINSTALL "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
  20.   Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
  21.  
  22. ;StartOptions Page strings
  23. LangString StartOptionsTitle ${LANG_ENGLISH} ": Server startup settings"
  24.  
  25. ;--------------------------------
  26. ;Modern UI Configuration
  27.  
  28.   !define MUI_ABORTWARNING
  29.  
  30.   !define MUI_ICON "..\res\filezilla server.ico"
  31.   !define MUI_UNICON "uninstall.ico"
  32.  
  33. ;--------------------------------
  34. ;Pages
  35.  
  36.   !insertmacro MUI_PAGE_LICENSE "..\..\license.txt"
  37.   !insertmacro MUI_PAGE_COMPONENTS
  38.   !insertmacro MUI_PAGE_DIRECTORY
  39.   Page custom StartOptions
  40.   Page custom InterfaceOptions
  41.   !insertmacro MUI_PAGE_INSTFILES
  42.  
  43.   !insertmacro MUI_UNPAGE_CONFIRM
  44.   !insertmacro MUI_UNPAGE_INSTFILES
  45.  
  46. ;--------------------------------
  47. ;Languages
  48.  
  49.   !insertmacro MUI_LANGUAGE "English"
  50.  
  51. ;--------------------------------
  52. ;More
  53.  
  54.   ;General
  55.   OutFile "../../FileZilla_Server.exe"
  56.  
  57.   ;Installation types
  58.   InstType "Standard"
  59.   InstType "Full"
  60.   InstType "Service only"
  61.   InstType "Interface only"
  62.  
  63.   ;Descriptions
  64.   LangString DESC_SecFileZillaServer ${LANG_ENGLISH} "Copy FileZilla Server to the application folder."
  65.   LangString DESC_SecFileZillaServerInterface ${LANG_ENGLISH} "Copy the administration interface to the application folder."
  66.   LangString DESC_SecSourceCode ${LANG_ENGLISH} "Copy the source code of FileZilla Server to the application folder"
  67.   LangString DESC_SecStartMenu ${LANG_ENGLISH} "Create shortcuts to FileZilla Server in the Start Menu"
  68.   LangString DESC_SecDesktopIcon ${LANG_ENGLISH} "Create an Icon on the desktop for quick access to the administration interface"
  69.  
  70.   ;Folder-selection page
  71.   InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
  72.   InstallDirRegKey HKLM "${PRODUCT_UNINSTALL}" "UninstallString"
  73.  
  74.   ShowInstDetails show
  75.  
  76. ;--------------------------------
  77. ;Reserve Files
  78.  
  79.   ;Things that need to be extracted on first (keep these lines before any File command!)
  80.   ;Only useful for BZIP2 compression
  81.  
  82.   ReserveFile "StartupOptions.ini"
  83.   ReserveFile "StartupOptions9x.ini"
  84.   ReserveFile "InterfaceOptions.ini"
  85.   !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
  86.  
  87. ;--------------------------------
  88. ;Installer Sections
  89.  
  90. Section "-default files"
  91.   SectionIn 1 2 3 4
  92.  
  93.   ; Set output path to the installation directory.
  94.   SetOutPath $INSTDIR
  95.  
  96.   ; Put file there
  97.   File "libeay32.dll"
  98.   File "ssleay32.dll"
  99.   File "..\..\readme.htm"
  100.   File "..\..\legal.htm"
  101.   File "..\..\license.txt"
  102.   File "dbghelp.dll"
  103.   ; Write the uninstall keys for Windows
  104.   WriteRegStr HKLM "${PRODUCT_UNINSTALL}" "DisplayName" "FileZilla Server (remove only)"
  105.   WriteRegStr HKLM "${PRODUCT_UNINSTALL}" "UninstallString" '"$INSTDIR\uninstall.exe"'
  106.   WriteUninstaller "$INSTDIR\Uninstall.exe"
  107.  
  108. SectionEnd
  109.  
  110. Section "FileZilla Server (Service)" SecFileZillaServer
  111.   SectionIn 1 2 3
  112.   ; Set output path to the installation directory.
  113.   SetOutPath $INSTDIR
  114.  
  115.   IfFileExists "$INSTDIR\FileZilla Server.exe" found
  116.  
  117.   File "..\Release\FileZilla Server.exe"
  118.  
  119.   DetailPrint "Stopping service..."
  120.   ExecWait '"$INSTDIR\FileZilla Server.exe" /stop'
  121.   ExecWait '"$INSTDIR\FileZilla Server.exe" /compat /stop'
  122.   Sleep 500
  123.   Push "FileZilla Server Helper Window"
  124.   call CloseWindowByName
  125.   DetailPrint "Uninstalling service..."
  126.   ExecWait '"$INSTDIR\FileZilla Server.exe" /uninstall'
  127.   Sleep 500
  128.   DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "${PRODUCT_NAME}"
  129.   DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "${PRODUCT_NAME}"
  130.   goto copy_main_done
  131.  found:
  132.   GetTempFileName $R1
  133.   File /oname=$R1 "..\Release\FileZilla Server.exe"
  134.   DetailPrint "Stopping service..."
  135.   ExecWait '"$R1" /stop'
  136.   ExecWait '"$R1" /compat /stop'
  137.   Sleep 500
  138.   Push "FileZilla Server Helper Window"
  139.   call CloseWindowByName
  140.   DetailPrint "Uninstalling service..."
  141.   ExecWait '"$R1" /uninstall'
  142.   Sleep 500
  143.   DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "${PRODUCT_NAME}"
  144.   DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "${PRODUCT_NAME}"
  145.   Delete "$INSTDIR\FileZilla Server.exe"
  146.   Rename $R1 "$INSTDIR\FileZilla Server.exe"
  147.  copy_main_done:
  148.  
  149.   ; Put file there
  150.   File "..\Release\FileZilla Server.pdb"
  151.   File "..\GFtp\Release\FzGss.dll"
  152. SectionEnd
  153.  
  154. Section "Administration interface" SecFileZillaServerInterface
  155.   SectionIn 1 2 4
  156.  
  157.   ; Set output path to the installation directory.
  158.   SetOutPath $INSTDIR
  159.  
  160.   ; Stopping interface
  161.   DetailPrint "Closing interface..."
  162.   Push "FileZilla Server Main Window"
  163.   Call CloseWindowByName
  164.  
  165.   File "..\Interface\Release\FileZilla Server Interface.exe"
  166.  
  167. SectionEnd
  168.  
  169. Section "Source Code" SecSourceCode
  170. SectionIn 2
  171.   SetOutPath $INSTDIR\source
  172.   File "..\*.cpp"
  173.   File "..\*.h"
  174.   File "..\FileZilla Server.sln"
  175.   File "..\FileZilla Server.vcproj"
  176.   File "..\FileZilla Server.rc"
  177.   SetOutPath $INSTDIR\source\res
  178.   File "..\res\*.ico"
  179.   SetOutPath $INSTDIR\source\misc
  180.   File "..\misc\*.h"
  181.   File "..\misc\*.cpp"
  182.   SetOutPath $INSTDIR\source\interface
  183.   File "..\interface\*.cpp"
  184.   File "..\interface\*.h"
  185.   File "..\interface\FileZilla Server Interface.vcproj"
  186.   File "..\interface\FileZilla Server.rc"
  187.   SetOutPath $INSTDIR\source\interface\res
  188.   File "..\interface\res\*.bmp"
  189.   File "..\interface\res\*.ico"
  190.   File "..\interface\res\*.rc2"
  191.   File "..\interface\res\manifest.xml"
  192.   SetOutPath $INSTDIR\source\interface\misc
  193.   File "..\interface\misc\*.h"
  194.   File "..\interface\misc\*.cpp"
  195.   SetOutPath $INSTDIR\source\install
  196.   File "FileZilla Server.nsi"
  197.   File "StartupOptions9x.ini"
  198.   File "StartupOptions.ini"
  199.   File "InterfaceOptions.ini"
  200.   File "uninstall.ico"
  201.   SetOutPath $INSTDIR\source\includes\openssl
  202.   File "..\includes\openssl\*.h"
  203.  
  204. SectionEnd
  205.  
  206. ; optional section
  207. Section "Start Menu Shortcuts" SecStartMenu
  208. SectionIn 1 2 3 4
  209.  
  210.   CreateDirectory "$SMPROGRAMS\FileZilla Server"
  211.   CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
  212.  
  213.   SectionGetFlags 1 $R0
  214.   IntOp $R0 $R0 & 1
  215.   IntCmp $R0 0 done_service_startmenu
  216.  
  217.   strcmp $1 "9x" shortcut9x
  218.   !insertmacro MUI_INSTALLOPTIONS_READ $R0 $2 "Field 2" "State"
  219.   StrCmp $R0 "Do not install as service, start server automatically (not recommended)" shortcut9x
  220.  
  221.   ;NT service shortcuts
  222.   CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Start FileZilla Server.lnk" "$INSTDIR\FileZilla Server.exe" "/start" "$INSTDIR\FileZilla Server.exe" 0
  223.   CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Stop FileZilla Server.lnk" "$INSTDIR\FileZilla Server.exe" "/stop" "$INSTDIR\FileZilla Server.exe" 0
  224.   goto done_service_startmenu
  225.  shortcut9x:
  226.   ;Compat mode
  227.   CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Start FileZilla Server.lnk" "$INSTDIR\FileZilla Server.exe" "/compat /start" "$INSTDIR\FileZilla Server.exe" 0
  228.   CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Stop FileZilla Server.lnk" "$INSTDIR\FileZilla Server.exe" "/compat /stop" "$INSTDIR\FileZilla Server.exe" 0
  229.  
  230.  done_service_startmenu:
  231.  
  232.   SectionGetFlags 2 $R0
  233.   IntOp $R0 $R0 & 1
  234.   IntCmp $R0 0 done_interface_startmenu
  235.  
  236.   CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\FileZilla Server Interface.lnk" "$INSTDIR\FileZilla Server Interface.exe" "" "$INSTDIR\FileZilla Server Interface.exe" 0
  237.  
  238.  done_interface_startmenu:
  239.  
  240.   SectionGetFlags 3 $R0
  241.   IntOp $R0 $R0 & 1
  242.   IntCmp $R0 0 done_source_startmenu
  243.  
  244.   CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\FileZilla Server Source Project.lnk" "$INSTDIR\source\FileZilla Server.sln" "" "$INSTDIR\source\FileZilla Server.sln" 0
  245.  
  246.  done_source_startmenu:
  247.  
  248. SectionEnd
  249.  
  250. Section "Desktop Icon" SecDesktopIcon
  251. SectionIn 1 2 4
  252.  
  253.   SectionGetFlags 2 $R0
  254.   IntOp $R0 $R0 & 1
  255.   IntCmp $R0 0 noDesktopIcon
  256.  
  257.   CreateShortCut "$DESKTOP\FileZilla Server Interface.lnk" "$INSTDIR\FileZilla Server Interface.exe" "" "$INSTDIR\FileZilla Server Interface.exe" 0
  258.  
  259.  noDesktopIcon:
  260.  
  261. SectionEnd
  262.  
  263. Section "-PostInst"
  264.  
  265.   ; Write the installation path into the registry
  266.   WriteRegStr HKCU "SOFTWARE\${PRODUCT_NAME}" "Install_Dir" "$INSTDIR"
  267.   WriteRegStr HKLM "SOFTWARE\${PRODUCT_NAME}" "Install_Dir" "$INSTDIR"
  268.  
  269.   SectionGetFlags 1 $R0
  270.   IntOp $R0 $R0 & 1
  271.   IntCmp $R0 0 NoSetAdminPort
  272.  
  273.   ;Set Adminport
  274.   !insertmacro MUI_INSTALLOPTIONS_READ $R0 $2 "Field 4" "State"
  275.   ExecWait '"$INSTDIR\FileZilla Server.exe" /adminport $R0'
  276.  
  277.   SectionGetFlags 2 $R0
  278.   IntOp $R0 $R0 & 1
  279.   IntCmp $R0 0 NoSetAdminPort
  280.  
  281.   ExecWait '"$INSTDIR\FileZilla Server Interface.exe" /adminport $R0'
  282.  NoSetAdminPort:
  283.  
  284.   SectionGetFlags 1 $R0
  285.   IntOp $R0 $R0 & 1
  286.   IntCmp $R0 0 done
  287.  
  288.   StrCmp $1 "9x" Install_9x
  289.  
  290.   !insertmacro MUI_INSTALLOPTIONS_READ $R0 $2 "Field 2" "State"
  291.   StrCmp $R0 "Do not install as service, started automatically (not recommended)" Install_Standard_Auto
  292.   DetailPrint "Installing Service..."
  293.   StrCmp $R0 "Install as service, started manually" Install_AsService_Manual
  294.  
  295.   ExecWait '"$INSTDIR\FileZilla Server.exe" /install auto'
  296.   goto done
  297.  Install_AsService_Manual:
  298.   ExecWait '"$INSTDIR\FileZilla Server.exe" /install'
  299.   goto done
  300.  Install_9x:
  301.   !insertmacro MUI_INSTALLOPTIONS_READ $R0 $2 "Field 2" "State"
  302.   StrCmp $R0 "Start manually" done
  303.  Install_Standard_Auto:
  304.   DetailPrint "Put FileZilla Server into registry..."
  305.   ClearErrors
  306.   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "FileZilla Server" '"$INSTDIR\FileZilla Server.exe" /compat /start'
  307.   IfErrors Install_Standard_Auto_CU
  308.   goto done
  309.  Install_Standard_Auto_CU:
  310.   WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "FileZilla Server" '"$INSTDIR\FileZilla Server.exe" /compat /start'
  311.  done:
  312.  
  313.   SectionGetFlags 2 $R0
  314.   IntOp $R0 $R0 & 1
  315.   IntCmp $R0 0 interface_done
  316.  
  317.   ;Write interface startup settings
  318.   !insertmacro MUI_INSTALLOPTIONS_READ $R0 $3 "Field 2" "State"
  319.   StrCmp $R0 "Start manually" interface_done
  320.   DetailPrint "Put FileZilla Server Interface into registry..."
  321.   StrCmp $R0 "Start if user logs on, apply only to current user" interface_cu
  322.   ClearErrors
  323.   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "FileZilla Server Interface" '"$INSTDIR\FileZilla Server Interface.exe"'
  324.   IfErrors interface_cu
  325.   goto interface_done
  326.  interface_cu:
  327.   WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "FileZilla Server Interface" '"$INSTDIR\FileZilla Server Interface.exe"'
  328.  interface_done:
  329.  
  330. SectionEnd
  331.  
  332. ;--------------------------------
  333. ;Descriptions
  334.  
  335. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  336.   !insertmacro MUI_DESCRIPTION_TEXT ${SecFileZillaServer} $(DESC_SecFileZillaServer)
  337.   !insertmacro MUI_DESCRIPTION_TEXT ${SecFileZillaServerInterface} $(DESC_SecFileZillaServerInterface)
  338.   !insertmacro MUI_DESCRIPTION_TEXT ${SecSourceCode} $(DESC_SecSourceCode)
  339.   !insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} $(DESC_SecStartMenu)
  340.   !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktopIcon} $(DESC_SecDesktopIcon)
  341. !insertmacro MUI_FUNCTION_DESCRIPTION_END
  342.  
  343. ;--------------------------------
  344. ;Installer Functions
  345.  
  346. Function .onInit
  347.  
  348.   ;Detect Windows type (NT or 9x)
  349.  
  350.   ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
  351.   StrCmp $R0 "" 0 detection_NT
  352.  
  353.   ; we are not NT.
  354.   StrCpy $1 "9x"
  355.  
  356.   ;Extract InstallOptions INI Files
  357.   !insertmacro MUI_INSTALLOPTIONS_EXTRACT "StartupOptions9x.ini"
  358.   StrCpy $2 "StartupOptions9x.ini"
  359.  
  360.   goto detection_end
  361.  detection_NT:
  362.   ; we are NT
  363.   StrCpy $1 "NT"
  364.  
  365.   ;Extract InstallOptions INI Files
  366.   !insertmacro MUI_INSTALLOPTIONS_EXTRACT "StartupOptions.ini"
  367.   strcpy $2 "StartupOptions.ini"
  368.  
  369.  detection_end:
  370.  
  371.   ;Extract InstallOptions INI Files
  372.   !insertmacro MUI_INSTALLOPTIONS_EXTRACT "InterfaceOptions.ini"
  373.   strcpy $3 "InterfaceOptions.ini"
  374.  
  375.  
  376. FunctionEnd
  377.  
  378. LangString TEXT_IO_TITLE ${LANG_ENGLISH} "Startup settings"
  379. LangString TEXT_IO_SUBTITLE ${LANG_ENGLISH} "Select startup behaviour for FileZilla Server"
  380.  
  381. Function StartOptions
  382.  
  383.   IfSilent DoneServerStartOptions
  384.  
  385.   SectionGetFlags 1 $R0
  386.   IntOp $R0 $R0 & 1
  387.   IntCmp $R0 0 DoneServerStartOptions
  388.  
  389.   SectionGetFlags 2 $R0
  390.   IntOp $R0 $R0 & 1
  391.   IntCmp $R0 1 ChangeNextTextToNext
  392.   !insertmacro MUI_INSTALLOPTIONS_WRITE $2 "Settings" "NextButtonText" "&Install"
  393.   goto DoneChangeNextText
  394.  ChangeNextTextToNext:
  395.   !insertmacro MUI_INSTALLOPTIONS_WRITE $2 "Settings" "NextButtonText" "&Next"
  396.  DoneChangeNextText:
  397.  
  398.  
  399.   !insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
  400.   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "$2"
  401.  
  402.  DoneServerStartOptions:
  403.  
  404. FunctionEnd
  405.  
  406. Function InterfaceOptions
  407.  
  408.   IfSilent DoneInterfaceStartOptions
  409.  
  410.   SectionGetFlags 2 $R0
  411.   IntOp $R0 $R0 & 1
  412.   IntCmp $R0 0 DoneInterfaceStartOptions
  413.  
  414.   !insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
  415.   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "InterfaceOptions.ini"
  416.  
  417.  DoneInterfaceStartOptions:
  418.  
  419. FunctionEnd
  420.  
  421. Function .onInstSuccess
  422.  
  423.   SectionGetFlags 1 $R0
  424.   IntOp $R0 $R0 & 1
  425.   IntCmp $R0 0 startserverend
  426.  
  427.  !insertmacro MUI_INSTALLOPTIONS_READ $R0 $2 "Field 5" "State"
  428.  
  429.   strcmp $R0 "0" startserverend
  430.  
  431.   strcmp $1 "9x" startserver9x
  432.   !insertmacro MUI_INSTALLOPTIONS_READ $R0 $2 "Field 2" "State"
  433.   StrCmp $R0 "Do not install as service, started automatically (not recommended)" startserver9x
  434.  
  435.   Exec '"$INSTDIR\FileZilla Server.exe" /start'
  436.   goto startserverend
  437.  startserver9x:
  438.   Exec '"$INSTDIR\FileZilla Server.exe" /compat /start'
  439.  startserverend:
  440.  
  441.   SectionGetFlags 2 $R0
  442.   IntOp $R0 $R0 & 1
  443.   IntCmp $R0 0 NoStartInterface
  444.  
  445.   !insertmacro MUI_INSTALLOPTIONS_READ $R0 $3 "Field 3" "State"
  446.   strcmp $R0 "0" NoStartInterface
  447.   Exec '"$INSTDIR\FileZilla Server Interface.exe"'
  448.  NoStartInterface:
  449. FunctionEnd
  450.  
  451. Function CloseWindowByName
  452.   Exch $R1
  453.  closewindow_start:
  454.   FindWindow $R0 $R1
  455.   strcmp $R0 0 closewindow_end
  456.   SendMessage $R0 ${WM_CLOSE} 0 0
  457.   Sleep 500
  458.   goto closewindow_start
  459.  closewindow_end:
  460.   Pop $R1
  461. FunctionEnd
  462.  
  463. Var prevSel
  464. Function .onSelChange
  465.  
  466.   SectionGetFlags 1 $R0
  467.   SectionGetFlags 2 $R1
  468.  
  469.   IntOp $R2 $R0 & 1
  470.   IntOp $R2 $R2 | $prevSel
  471.   IntCmp $R2 1 +2
  472.     IntOp $R1 $R1 | 1
  473.  
  474.   IntOp $R2 $R1 & 1
  475.   IntCmp $R2 1 +2
  476.     IntOp $R0 $R0 | 1
  477.  
  478.   SectionSetFlags 1 $R0
  479.   SectionSetFlags 2 $R1
  480.  
  481.   IntOp $prevSel $R1 & 1
  482.  
  483. FunctionEnd
  484.  
  485. ;--------------------------------
  486. ;Uninstaller Section
  487.  
  488. Section "Uninstall"
  489.  
  490.   ; Stopping and uninstalling service
  491.   DetailPrint "Stopping service..."
  492.   ExecWait '"$INSTDIR\FileZilla Server.exe" /stop'
  493.   Sleep 500
  494.   Push "FileZilla Server Helper Window"
  495.   Call un.CloseWindowByName
  496.   DetailPrint "Uninstalling service..."
  497.   ExecWait '"$INSTDIR\FileZilla Server.exe" /uninstall'
  498.   Sleep 500
  499.  
  500.   ; Stopping interface
  501.   DetailPrint "Closing interface..."
  502.   Push "FileZilla Server Main Window"
  503.   Call un.CloseWindowByName
  504.  
  505.   ; remove registry keys
  506.   DeleteRegValue HKCU "Software\${PRODUCT_NAME}" "Install_Dir"
  507.   DeleteRegValue HKLM "Software\${PRODUCT_NAME}" "Install_Dir"
  508.   DeleteRegKey /ifempty HKCU "Software\${PRODUCT_NAME}"
  509.   DeleteRegKey /ifempty HKLM "Software\${PRODUCT_NAME}"
  510.   MessageBox MB_YESNO "Delete settings?" IDNO NoSettingsDelete
  511.   Delete "$INSTDIR\FileZilla Server.xml"
  512.   Delete "$INSTDIR\FileZilla Server Interface.xml"
  513.  NoSettingsDelete:
  514.   DeleteRegKey HKLM "${PRODUCT_UNINSTALL}"
  515.   ; remove files
  516.   Delete "$INSTDIR\FileZilla Server.exe"
  517.   Delete "$INSTDIR\FileZilla Server Interface.exe"
  518.   Delete "$INSTDIR\FileZilla Server.pdb"
  519.   Delete "$INSTDIR\ssleay32.dll"
  520.   Delete "$INSTDIR\libeay32.dll"
  521.   Delete $INSTDIR\FzGss.dll
  522.   Delete "$INSTDIR\dbghelp.dll"
  523.   Delete $INSTDIR\license.txt
  524.   Delete $INSTDIR\readme.htm
  525.   Delete $INSTDIR\legal.htm
  526.   Delete $INSTDIR\source\*.cpp
  527.   Delete $INSTDIR\source\*.h
  528.   Delete "$INSTDIR\source\FileZilla Server.sln"
  529.   Delete "$INSTDIR\source\FileZilla Server.vcproj"
  530.   Delete "$INSTDIR\source\FileZilla Server.rc"
  531.   Delete $INSTDIR\source\res\*.ico
  532.   Delete $INSTDIR\source\res\*.bmp
  533.   Delete $INSTDIR\source\res\*.rc2
  534.   Delete $INSTDIR\source\misc\*.h
  535.   Delete $INSTDIR\source\misc\*.cpp
  536.   Delete $INSTDIR\source\interface\*.cpp
  537.   Delete $INSTDIR\source\interface\*.h
  538.   Delete "$INSTDIR\source\interface\FileZilla Server Interface.vcproj"
  539.   Delete "$INSTDIR\source\interface\FileZilla Server.rc"
  540.   Delete $INSTDIR\source\interface\res\*.ico
  541.   Delete $INSTDIR\source\interface\res\*.bmp
  542.   Delete $INSTDIR\source\interface\res\*.rc2
  543.   Delete $INSTDIR\source\interface\res\manifest.xml
  544.   Delete $INSTDIR\source\interface\misc\*.h
  545.   Delete $INSTDIR\source\interface\misc\*.cpp
  546.   Delete $INSTDIR\source\install\uninstall.ico
  547.   Delete "$INSTDIR\source\install\FileZilla Server.nsi"
  548.   Delete "$INSTDIR\source\install\StartupOptions.ini"
  549.   Delete "$INSTDIR\source\install\StartupOptions9x.ini"
  550.   Delete "$INSTDIR\source\install\InterfaceOptions.ini"
  551.   Delete "$INSTDIR\source\includes\openssl\*.h"
  552.  
  553.   ; MUST REMOVE UNINSTALLER, too
  554.   Delete $INSTDIR\uninstall.exe
  555.  
  556.   ; remove shortcuts, if any.
  557.   Delete "$SMPROGRAMS\${PRODUCT_NAME}\*.*"
  558.   Delete "$DESKTOP\FileZilla Server Interface.lnk"
  559.   RMDir "$SMPROGRAMS\${PRODUCT_NAME}"
  560.  
  561.   ; remove directories used.
  562.  
  563.   RMDir "$INSTDIR\source\res"
  564.   RMDir "$INSTDIR\source\misc"
  565.   RMDir "$INSTDIR\source\interface\res"
  566.   RMDir "$INSTDIR\source\interface\misc"
  567.   RMDir "$INSTDIR\source\interface"
  568.   RMDir "$INSTDIR\source\install"
  569.   RMDir "$INSTDIR\source\includes\openssl"
  570.   RMDir "$INSTDIR\source\includes"
  571.   RMDir "$INSTDIR\source"
  572.   RMDir "$INSTDIR"
  573.   DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "FileZilla Server"
  574.   DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "FileZilla Server"
  575.   DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "FileZilla Server Interface"
  576.   DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "FileZilla Server Interface"
  577.  
  578.   RMDir "$INSTDIR"
  579.  
  580. SectionEnd
  581.  
  582. ;--------------------------------
  583. ;Uninstaller Functions
  584.  
  585. Function un.CloseWindowByName
  586.   Exch $R1
  587.  unclosewindow_start:
  588.   FindWindow $R0 $R1
  589.   strcmp $R0 0 unclosewindow_end
  590.   SendMessage $R0 ${WM_CLOSE} 0 0
  591.   Sleep 500
  592.   goto unclosewindow_start
  593.   Pop $R1
  594.  unclosewindow_end:
  595. FunctionEnd
  596.